/*
 * XmlAttribute.cpp
 *
 * Modela un atributo asociado a un tag.
 */

#include "XmlAttribute.h"

XmlAttribute::XmlAttribute(string name) {
	this->name = name; 
}

XmlAttribute::XmlAttribute(string name, string value) {
	this->name = name;
	this->value = value;
}
XmlAttribute::~XmlAttribute() {

}
string * XmlAttribute::getName(void) {
	return &name;
}
void XmlAttribute::setName(string name) {
	this->name = name;
}
string * XmlAttribute::getValue(void) {
	return &value;
}
void XmlAttribute::setValue(string value) {
	this->value = value;
}
int XmlAttribute::getLine(void) {
	return line;
}
void XmlAttribute::setLine(int line) {
	this->line = line;
}
int XmlAttribute::getColumn(void) {
	return column;
}
void XmlAttribute::setColumn(int column) {
	this->column = column;
}

string & XmlAttribute::toString(void) {
	string *PStringValue = new string("\n");
	string &toStringValue = * PStringValue;

	char bufferLine[5], bufferColumn[5];
	_itoa_s(getLine(), bufferLine, 10);
	_itoa_s(getColumn(), bufferColumn, 10);
	toStringValue = "XmlAttribute: name:";
	toStringValue.append(getName()->c_str());
	toStringValue.append(" ,Value:");
	toStringValue.append(getValue()->c_str());
	toStringValue.append(" ,Line:");
	toStringValue.append(bufferLine);
	toStringValue.append(" ,Column:");
	toStringValue.append(bufferColumn);

	return toStringValue;
}
